/**
 * Created by Administrator on 2017/2/8.
 */
    var key;
    if (getQueryString('key') != '') {
        var key = getQueryString('key');
        var username = getQueryString('username');
        addCookie('key', key);
        addCookie('username', username);
    } else {
        key = getCookie('key');
    }
    if(key){
        $.ajax({
            type:'post',
            url:ApiUrl+"/index.php?act=member_promotion&op=list",
            data:{key:key},
            dataType:'json',
            //jsonp:'callback',
            success:function(result){
                var datas = result.datas.promotion_info;
                var Html = '';
                for (var i=0;i<datas.length;i++) {
                    Html += '<a href="promotion_details.html?mid='+datas[i]['member_id']+'"><li> <p><span>'+datas[i]['member_name']+'</span> <span class="span1"> [一级分销]</span></p> </li></a>'
                }
                //return;
                document.getElementById('content').innerHTML = Html;
                document.getElementsByClassName('loading')[0].style.display = 'none';
            }
        });
    } else {
        var html = '<span class="left"><a href="##">151</a></span><span class="right"><a href="##">充值</a></span><p><img class="touxiang"src="'+WapSiteUrl+'/data/upload/shop/common/default_user_portrait.gif"></p><div class="gologin"><a href="'+WapSiteUrl+'/tmpl/member/login.html">立即登录</a></div>';
        //
        $(".center").html(html);
    }

    //滚动header固定到顶部
    //$.scrollTransparent();

var Lev = 0;
function tabContent(obj,lev){
    Lev = lev;
    var tabA = document.getElementsByClassName('top')[0].getElementsByTagName('p');
    for(var i=0;i<tabA.length;i++){
          tabA[i].className ='';
    }
    switch (Lev){
        case 1:
            levstr = "一"
            break
        case 2:
            levstr = "二"
            break
        case 3:
            levstr = "三"
            break
    }
    obj.className = 'active';
    $.ajax({
        type:'post',
        url:ApiUrl+"/index.php?act=member_promotion&op=list",
        data:{key:key,Lev:lev},
        dataType:'json',
        //jsonp:'callback',
        success:function(result){
            var datas = result.datas.promotion_info;
            var Html = '';
            for (var i=0;i<datas.length;i++) {
                Html += '<a href="promotion_details.html?mid='+datas[i]['member_id']+'"><li> <p><span>'+datas[i]['member_name']+'</span> <span class="span1"> ['+levstr+'级分销]</span></p> </li></a>'
            }
            document.getElementById('content').innerHTML = Html;
        }
    });
}